package com.adminsite.base;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.core.base.util.UserContext;

/**
 * ClassName: LoginInterceptor
 * 
 * @Description: 登录拦截器
 * @author Administrator
 * @date 2017年12月29日
 *
 *
 */

public class LoginInterceptor extends HandlerInterceptorAdapter {

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {

		if (UserContext.getCurrent() == null) {
			response.sendRedirect("toLogin.shtml");
			return false;
		} else {
			return super.preHandle(request, response, handler);
		}
	}

}
